﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EnvironmentManagerSystem.MODE;
using Maticsoft.DBUtility;
using System.Data;

namespace EnvironmentManagerSystem.BLL
{
    public class ExpertKind
    {
        public static ExpertKindDataList GetList()
        {
            try
            {
                ExpertKindDataList lst = new ExpertKindDataList();
                StringBuilder br = new StringBuilder();
                br.Append(" select ");
                br.Append(" tbs001_expertkind.id, ");
                br.Append(" tbs001_expertkind.ExpertKindCode, ");
                br.Append(" tbs001_expertkind.ExpertKindName  ");
                br.Append(" from tbs001_expertkind");

                DataTable dt = DbHelperMySQL.Query(br.ToString()).Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ExpertKindData model = new ExpertKindData();
                    model.ID = Convert.ToInt32(dt.Rows[i].ItemArray[0]);
                    model.ExpertKindCode = dt.Rows[i].ItemArray[1].ToString();
                    model.ExpertKindName = dt.Rows[i].ItemArray[2].ToString();

                    lst.Add(model);
                }
                return lst;
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(ex.Message);
                return null;
            }
        }
    }
}
